#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e5 + 5;

int n, m, q;
int a[N], b[N];
int op[N], l[N], r[N];
int tr[N << 2], tag[N << 2];
void pushup(int p) { tr[p] = tr[p << 1] + tr[p << 1 | 1]; }
void build(int p, int l, int r) {
  tag[p] = -1;
  if (l == r) {
    tr[p] = b[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
void addtag(int val, int p, int l, int r) {
  tr[p] = (r + 1 - l) * val;
  tag[p] = val;
}
void pushdown(int p, int l, int r) {
  if (tag[p] != -1) {
    int mid = (l + r) >> 1;
    addtag(tag[p], p << 1, l, mid);
    addtag(tag[p], p << 1 | 1, mid + 1, r);
    tag[p] = -1;
  }
}
void update(int L, int R, int val, int p, int l, int r) {
  if (L > R) return;
  if (L <= l && R >= r) {
    addtag(val, p, l, r);
    return;
  }
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  if (L <= mid) update(L, R, val, p << 1, l, mid);
  if (R > mid) update(L, R, val, p << 1 | 1, mid + 1, r);
  pushup(p);
}
int query(int L, int R, int p, int l, int r) {
  if (L > R) return 0;
  if (L <= l && R >= r) return tr[p];
  pushdown(p, l, r);
  int mid = (l + r) >> 1;
  int res = 0;
  if (L <= mid) res += query(L, R, p << 1, l, mid);
  if (R > mid) res += query(L, R, p << 1 | 1, mid + 1, r);
  return res;
}
bool check(int x) {  // x is greater or equal than the given val
  rep(i, 1, n) b[i] = a[i] >= x;
  build(1, 1, n);
  rep(i, 1, m) {
    int left = l[i], right = r[i];
    int cnt = query(left, right, 1, 1, n);
    if (!op[i]) {  // inc
      int mid = right + 1 - cnt;
      update(left, mid - 1, 0, 1, 1, n);
      update(mid, right, 1, 1, 1, n);
    } else {
      int mid = left + cnt;
      update(left, mid - 1, 1, 1, 1, n);
      update(mid, right, 0, 1, 1, n);
    }
  }

  return query(q, q, 1, 1, n) == 1;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, m) cin >> op[i] >> l[i] >> r[i];
  cin >> q;
  int x1 = 1, x2 = 1e9;
  while (x1 <= x2) {
    int mid = (x1 + x2) >> 1;
    if (check(mid))  // x is greater or equal than mid
      x1 = mid + 1;
    else
      x2 = mid - 1;
  }
  cout << x2;
  return 0;
}